﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace AutoRAR_dot_net
{
    public partial class Hauptfenster : Form
    {
        RARThread_C myRARThread;

        public Hauptfenster()
        {
            InitializeComponent();
        }

        private void button_ordnerOeffnen_Click(object sender, EventArgs e)
        {
            if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
            {
                textBox_ordner.Text = folderBrowserDialog.SelectedPath;
            }
        }

        private void button_winRAROeffnen_Click(object sender, EventArgs e)
        {
            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                textBox_rarPfad.Text = openFileDialog.FileName;
            }
        }

        private void button_start_Click(object sender, EventArgs e)
        {
            myRARThread = new RARThread_C(textBox_rarPfad.Text, textBox_ordner.Text, textBox_size.Text, textBox_password.Text);

            myRARThread.start();
        }

        private void Hauptfenster_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (myRARThread != null)
            {
                if (myRARThread.isRunning)
                {
                    myRARThread.stop();
                }

            }
        }
    }
}
